import Vue from 'vue'
import axios from 'axios'

axios.defaults.baseURL = 'http://127.0.0.1:3000';
// 请求拦截器
axios.interceptors.request.use(function(request){
    let tokens  = localStorage.getItem('loginture')||'{}'
    let tokentrure  = JSON.parse(tokens).token
    if(tokentrure){
        request.headers.Authorization = tokentrure
    }
    return request
})
axios.interceptors.response.use(function(response){
    return response.data
})
Vue.prototype.$http=axios
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
Vue.prototype.lujing='http://127.0.0.1:3000'
export default axios